var express = require("express");
var router = express.Router();
const jwt = require("jsonwebtoken"); //生成token
// 可以接受图片
const multiparty = require("multiparty");

// 导入model.js
var { RiplanModel } = require("../model/model");
// 加密密码
const bcrypt = require("bcryptjs");

// 日计划列表
router.get("/riplan_list", async (req, res) => {
  let pageIndex = req.query.pageIndex;
  let pageSize = req.query.pageSize;
  console.log(req.query);
  let list = [];
  let total = 0;
  list = await RiplanModel.find()
    .skip((pageIndex - 1) * pageSize)
    .limit(pageSize)
    .sort({ times: -1 })
    .exec();
  total = list.length;
  res.send({
    code: 200,
    msg: "展示成功",
    data: list,
    total: total,
  });
});

module.exports = router;
